<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>PCMS内容管理系统</title>
<link href="<?php echo $_tpl['css']; ?>admin.css" rel="stylesheet" type="text/css" />
</head>
<body class="admin_left_bg" style='width:131px;height:auto;margin:0px;' >
	<div class="admin_left" >
		<div class="admin_left_title">&nbsp;&nbsp;&gt;&gt;功能列表</div>
		<?php
			$index = 0;
			foreach( $menu_array as $data )
			{
		?>
		<span class="admin_left_menu" id='span_<?php echo $index; ?>'><a  href="javascript:void(0)" class='menu_item' onclick='show(this)' >·<?php echo $data['name']; ?></a></span>
		<ul class="admin_left_content" id='ul_<?php echo $index++; ?>' style='marign:0px;display:none;list-style:none' >
		<?php
			foreach( $data['item'] as $value )
			{
		?>
		<li><a href="<?php echo $value['url']; ?>" onclick="my_click(this)" target="<?php echo $value['target']; ?>"><?php echo $value['name']; ?></a><?php if ( isset( $value['new_window'] ) ) { ?> <a target="_blank" href="<?php echo $value['url']; ?>"   onclick="my_click(this)" title="打开新窗口方式"><img src="<?php echo $_tpl['images']; ?>external.png" border="0" style="margin-top:5px;"></a><?php } ?></li>
		<?php
			}
		?>
		</ul>
		<?php
			}
		?>
	</div>

<script>
var last_click = null;
var show_all = true;
var now_show = 0;
function show(o)
{
	if(show_all)
	{
		var ul_id = parseInt(o.parentNode.id.split("_").pop());
		var ul_obj = document.getElementById("ul_"+ul_id);
		if(ul_obj)
		{

			ul_obj.style.display = (ul_obj.style.display=="none")?"block":"none";
		}
		return false;
	}
	o.className = "click";
	var ul_obj = document.getElementById("ul_"+now_show);
	if(ul_obj)
	{
		ul_obj.style.display = "none";
	}
	var p = o.parentNode;
	var pid = p.id;
	var to_show_id = parseInt(pid.split("_").pop());
	var ti_show_ul_obj = document.getElementById("ul_"+to_show_id);
	if(ti_show_ul_obj)
	{
		ti_show_ul_obj.style.display = "block";
	}
	if(now_show != to_show_id)
	{
		var span_obj = document.getElementById("span_"+now_show);
		span_obj.childNodes[0].className = "";
		now_show = to_show_id;
	}
}

function my_click(o)
{
	if(last_click)
	{
		last_click.style.color = "#B9B9B9";
	}
	last_click = o;
	o.style.color = "#ff0000";
	var arr = document.getElementsByTagName("a");
	for(var i=0;i<arr.length;i++)
	{
		var tmp = arr[i];
		if(tmp.className == "click")
		{
			tmp.className = "menu_item";
		}
	}
	var id = parseInt(o.parentNode.parentNode.id.split("_").pop());
	var my_a = document.getElementById("span_"+id).childNodes[0];
	my_a.className = "click";
}


function init()
{
	var ul_arr = document.getElementsByTagName("ul");
	for(var i=0;i<ul_arr.length;i++)
	{
		var tmp = ul_arr[i];
		if(show_all)
		{
			tmp.style.display = "block";
		}
		else
		{
			var id = parseInt(tmp.id.split("_").pop());
			if(now_show==id)
			{
				document.getElementById("span_"+id).childNodes[0].className = "click";
				tmp.style.display = "block";
			}
		}
	}
}
init();
</script>

</body>
</html>